from django.contrib import admin
from  celery_tasks.static_html.tasks import generate_static_list_search_html

# Register your models here.
from goods import models

# 控制显示字段
class GoodsModelAdmin(admin.ModelAdmin):
    list_display = ('name','sales')

    def save_model(self, request, obj, form, change):
        # 当运营人员点击保存按钮是被触发,调用异步任务

        generate_static_list_search_html.delay()


class SKUModelAdmin(admin.ModelAdmin):
    def delete_model(self, request, obj):
        # 当运营人员点击删除按钮是被触发

        generate_static_list_search_html.delay()




admin.site.register(models.Goods,GoodsModelAdmin)
admin.site.register(models.SKU,SKUModelAdmin)
admin.site.register(models.SKUImage)
